load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
load("@npm//:defs.bzl", "npm_link_all_packages")

npm_link_all_packages(name = "node_modules")

exports_files([
    ".npmrc.bazel",
    "package.json",
    "pnpm-lock.yaml",
])

go_library(
    name = "ui",
    srcs = ["ui.go"],
    importpath = "github.com/cockroachdb/cockroach/pkg/ui",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/base",
        "//pkg/build",
        "//pkg/server/serverpb",
        "//pkg/settings",
        "//pkg/settings/cluster",
        "//pkg/util/httputil",
        "//pkg/util/log",
    ],
)

test_suite(
    name = "test",
    tests = [
        "//pkg/ui/workspaces/cluster-ui:jest",
        "//pkg/ui/workspaces/db-console:jest",
    ],
)

test_suite(
    name = "lint",
    tests = [
        "//pkg/ui/workspaces/cluster-ui:lint",
        "//pkg/ui/workspaces/db-console:lint",
    ],
)

go_test(
    name = "ui_test",
    srcs = ["ui_test.go"],
    embed = [":ui"],
    deps = [
        "//pkg/base",
        "//pkg/util/leaktest",
        "//pkg/util/log",
        "@com_github_stretchr_testify//require",
    ],
)
